Auto merge of #1991 - carols10cents:pipelinify, r=alexcrichton
authorbors <bors@rust-lang.org>
Tue, 22 Sep 2015 01:47:44 +0000 (01:47 +0000)
committerbors <bors@rust-lang.org>
Tue, 22 Sep 2015 01:47:44 +0000 (01:47 +0000)
Hi! This is an attempt to start refactoring some of the internals to be more like a pipeline, and eventually enable the kind of functionality I tried to add in #1968 without having to add as much duplication. Turns out there's a fair bit of duplication in the code today, I think this helps address it!

I may have totally gone against some abstractions... namely I made a way to create `Package`s from a `manifest_path` and a `config`, without needing a `Source`. I think it cleans up the code quite a bit, and I think makes things a bit more pipeliney in that the `Source` isn't updated until we really need it to be (as opposed to having to use `preload` to avoid updating it again). But I'm open to the possibility that I'm moving things around to where no one who knows the code well will be able to find them ;)

This *should* be a Real Refactor in the sense that these changes don't change behavior-- except in one test case, where the same error happens as did before, but it's going through a `chain_error` now so has a slightly different message.

1  2 
src/cargo/core/package.rs
src/cargo/core/registry.rs
src/cargo/ops/cargo_clean.rs
src/cargo/ops/cargo_compile.rs
src/cargo/ops/cargo_package.rs
src/cargo/ops/resolve.rs
src/cargo/sources/path.rs

Simple merge
Simple merge
index 2c1818667fcd91cec95622b44be9c24bd74cc111,8a28168c9b6df7fbfc3505534f76ee136852111e..c3303423e8b68ce66f6b32a7a650ee9ed975d89e
@@@ -17,13 -16,10 +16,10 @@@ pub struct CleanOptions<'a> 
  
  /// Cleans the project from build artifacts.
  pub fn clean(manifest_path: &Path, opts: &CleanOptions) -> CargoResult<()> {
-     let mut src = try!(PathSource::for_path(manifest_path.parent().unwrap(),
-                                             opts.config));
-     try!(src.update());
-     let root = try!(src.root_package());
+     let root = try!(Package::for_path(manifest_path, opts.config));
      let target_dir = opts.config.target_dir(&root);
  
 -    // If we have a spec, then we need to delete some package,s otherwise, just
 +    // If we have a spec, then we need to delete some packages, otherwise, just
      // remove the whole target directory and be done with it!
      let spec = match opts.spec {
          Some(spec) => spec,
Simple merge
Simple merge
Simple merge
Simple merge